#!/bin/bash

index=$1

curl -XPUT http://10.141.211.94:9200/${index}/ -d '
{
  "mappings" : {
  "image" : {
    "properties" : {
      "Tags" : {
        "type" : "nested",
        "properties" : {
          "tag_id" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          },
          "tag_name" : {
            "type" : "text",
            "index_options" : "docs",
            "analyzer" : "dic_ansj",
            "search_analyzer" : "dic_ansj"
          },
          "tag_score" : {
            "type" : "float"
          },
          "tag_source" : {
            "type" : "text",
            "fielddata" : true
          }
        }
      },
      "imgLocalURL" : {
        "type" : "text"
      },
      "imgOriginalURL" : {
        "type" : "text"
      },
      "img_cate" : {
        "type" : "text",
        "fielddata" : true
      },
      "img_id" : {
        "type" : "text",
        "fields" : {
          "keyword" : {
            "type" : "keyword",
            "ignore_above" : 256
          }
        }
      },
      "img_source" : {
        "type" : "text",
        "fielddata" : true
      },
      "top_topics": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "article_id": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      }
    }
  }
}
}
';
